package designerMode.enventMode;

import java.util.ArrayList;
import java.util.List;

/**
 * 事件源
 *
 * @author liuchaoqun
 * @date 2022/11/24
 */
public class EventSource {

    private List<EventListener> listenerList = new ArrayList<>();

    public void register(EventListener listener) {
        listenerList.add(listener);
    }

    public void publishEvent(Event event) {
        listenerList.forEach(listener -> listener.processEvent(event));

    }

}
